/*    file: TimeChecker.h
 *    desc:
 *   
 * created: 2016-06-30
 *  author: chuanjiang.zh@qq.com
 * company: 
 */ 


#if !defined TimeChecker_H_
#define TimeChecker_H_

#include "TimePoint.h"
#include "TimeHelper.h"


namespace util
{

class TimeChecker
{
public:
	static const int DEFAULT_GAP = 1000 * 40 * 4;

public:
    
    TimeChecker();

    void reset();
    
    bool input(int64_t clk, int64_t pts);

	void setClockGap(int64_t gap);

	void setPtsGap(int64_t gap);

	int64_t getClockDuration() const;

	int64_t getPtsDuration() const;

	int64_t getCount() const;

protected:
	int64_t	m_clockGap;
	int64_t m_ptsGap;


    av::TimePoint m_start;
    av::TimePoint m_cur;
    int64_t   m_count;

};


}



#endif //TimeChecker_H_

